package com.example.run_game;

import java.util.Comparator;

public class CheckpointComparator implements Comparator<Checkpoint> {
	
	private int ckpsVisited;
	private Checkpoint current;	
	
	CheckpointComparator(int ckpsVisitedIn, Checkpoint currentIn)
	{
		ckpsVisited=ckpsVisitedIn;
		current = currentIn;
	}
	
    @Override
    public int compare(Checkpoint o1, Checkpoint o2) {
    	if(o1.getWeight(ckpsVisited, current) > o2.getWeight(ckpsVisited, current))
    		return 1;
    	else if(o1.getWeight(ckpsVisited, current) < o2.getWeight(ckpsVisited, current))
            return -1;
    	else
            return 0;
    }
}